package com.project.web.controller.sys;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.hibernate.criterion.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.project.web.controller.BaseController;
import com.project.entity.sys.SysLog;
import com.project.service.sys.SysLogService;

/**
 * RoleController
 * @author weimingsen
 *
 */
@Controller
@RequestMapping("/sysLog")
public class SysLogController extends BaseController<SysLog>{

	private static final Logger logger = LoggerFactory.getLogger(SysLogController.class);
	
	@Autowired
	private SysLogService sysLogService;
	
	/**
	 * 系统日志列表
	 * @param model
	 * @param request
	 * @param page
	 * @return
	 */
	@RequestMapping(value="list")
	@RequiresPermissions("log:list")
	public String list(Model model,HttpServletRequest request,@ModelAttribute SysLog sysLog) throws Exception{
		sysLog.setcOrder(Order.desc("createTime"));
		model.addAttribute("page", sysLogService.queryPage(sysLog));
		model.addAttribute("sysLog", sysLog);
		return "/sysLog/sysLogList";
	}

	@Override
	protected Class<SysLog> getClazz() {
		return SysLog.class;
	}

}
